import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
// https://vite.dev/config/
export default defineConfig({
  server: {
    host: '127.0.0.1', // 或者 '0.0.0.0'
    port: 3000, // 你可以选择一个不同的端口
    proxy: {
      '/ws': {
        target: 'http://127.0.0.1:8080',
        changeOrigin: true,
        ws: true
      },
      "/dev-api": {
        target: "http://127.0.0.1:8080",
        changeOrigin: true,
        rewrite: p => p.replace(/^\/dev-api/, ""),
      },
    }
  },
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
})
